<?php
/**
 *
 * User: wufeng
 * Date: 2020/03/02
 */

namespace app\xcxapi\controller\v1;
use app\common\controller\XcxController;
use app\xcxapi\service\CommentService;

class Comment extends XcxController
{
	/**
	 * 班级点评列表
	 * User: wufeng
	 * Date: 2020/03/02
	 *
	 */
	public function classCommentLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = '';
			if (1 === (int) $params['api_type']) {
				$list = (new CommentService($this->type))->classCommentWeekLists($params);
			}elseif (2 === (int) $params['api_type']){
				$list = (new CommentService($this->type))->classCommentAllLists($params);
			}
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 课节点评列表
	 * User: wufeng
	 * Date: 2020/03/03
	 *
	 */
	public function classDayCommentLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommentService($this->type))->classDayCommentLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 课节点评详情
	 * User: wufeng
	 * Date: 2020/03/05
	 *
	 */
	public function classDayCommentDetail()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommentService($this->type))->classDayCommentDetail($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 课节点评
	 * User: wufeng
	 * Date: 2020/03/05
	 *
	 */
	public function classDayComment()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommentService($this->type))->classDayComment($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
}